import threading
import urllib,urllib2,random


def create_user():
    url = 'http://127.0.0.1:3000/api/example'
	
	values = {'username':'914u'+str(random.randint(0,1000000)),'email':'914e'+str(random.randint(0,1000000))+'@123.com','password':'123'}
	data = urllib.urlencode(values)
	req = urllib2.Request(url,data)
	response = urllib2.urlopen(req)
	the_page = response.read()
	print the_page
	
def main():
	threads = []
	number = 10
	for i in range(number):
		t = threading.Thread(target=create_user,args=())
		threads.append(t)
	
	for i in range(number):
		threads[i].start()
		
	for i in range(number):
		threads[i].join()
		
if __name__=='__main__':
	main()